﻿<!--#include file="../Include/Config.asp"-->
<%
'----------------------------------------------------------
'页面功能：问卷清零执行文件。
'最后修改时间：2007-12-04 19时2分
'作者：legal http://www.ilegal.cn
'备注：
'----------------------------------------------------------
dim sql,Survey_id
Survey_id=request.QueryString("Survey_id")
Call CheckNum(Survey_id)
sql="select Survey_name,Survey_content,Survey_hits,Survey_usehits from survey where Survey_id="&Survey_id
rs.CursorLocation = 3
rs.open sql,conn,1,3
if rs.eof then
call ShowAlert("参数错误","../index.asp") 
end if
Survey_content=rs(1)
application.Lock()
rs("Survey_usehits")=0
rs("Survey_hits")=0
rs.update
application.unLock()
rs.close

if not Survey_content="" then
Survey_question=split(Survey_content,",")
for i=0 to ubound(Survey_question)
'----------------------------------------------------------
'清空数据库中关于该问卷下自定义文本的存储
'----------------------------------------------------------
sql="delete from text where Text_belong="&Survey_question(i)
application.Lock()
conn.execute(sql)
application.UnLock()
'----------------------------------------------------------
'清空数据库问卷所有题目的已有结果
'----------------------------------------------------------
sql="select Question_answer,Question_result from question where Question_id="&Survey_question(i)
rs.open sql,conn,1,3
if rs.eof or rs.bof then
else
  if not rs("Question_answer")="" then
    Question_answer=split(rs("Question_answer"),"&")
	for j=0 to ubound(Question_answer)
	  if Question_result="" then
	     Question_result="0"
	  else
	     Question_result=Question_result&",0"	 
	  end if	 
	next
  application.Lock()	
  rs("Question_result")=Question_result
  rs.update
  application.UnLock()
  end if
end if
rs.close
Question_result=""
next
end if
call ShowAlert("清零成功","SurveyStatis.asp") 
%>
